﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    


<head>
	<script type="text/javascript">
		$(function(){
			
				init();
			
			
		});
		
			function init(){
				$('#t-dg').datagrid({
				loadMsg:''
				
			});
				
			}

		function formatcreatedate(value,row){
   if (row.createdate){
      return row.createdate.substring(0,10);
   } else {
      return "";
   }
}
function formatarea(value,row){
   if (row.area){
      return row.area + " 平方米";
   } else {
      return "";
   }
}
function formatitype(value,row){
   if (row.itype == 1){
      return "一手楼盘";
   } 
   if (row.itype == 2){
      return "二手楼盘";
   }
}

		

		
		
		function deleteItem(){
			var t = $('#t-dg');
			var row = t.datagrid('getSelected');
			if (row){
				
				$.messager.confirm('删除确认', '是否确定要删除选择房管已售房源?', function(r){
						if (r){
				$.ajax({
					url:'<c:url value="/myinfo/Cjdata/destroyCjdata"/>?id=' + row.id,
					type:'post',
					success:function(){
						$('#t-dg').datagrid('reload');
					}
				});
			}});
				
			}
		}
		
		
		function doQuery(value){
			$('#t-dg').datagrid('load', {
				q: value
			});
		}
	</script>
</head>
<body>
	<div class="easyui-layout" fit="true">
		<div region="north" border="false" style="height:40px;padding:5px;overflow:hidden;">
		<div style="padding-top:3px;float:left">
			<input class="easyui-searchbox" prompt="按房源地址|面积|成交日期进行查询" searcher="doQuery" style="width:300px"></input>
			</div>
		<c:if test="${readmode != 'true'}">
			<!--  <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newItem()">新增已售房源</a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editItem()">修改已售房源</a>-->
			<div style="float:left">
			<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteItem()">删除已售房源</a>			
            </div>
		</c:if>
		</div>
		
		
		<div region="center" border="true">
			<table id="t-dg" style="display:none;"
					url="<c:url value='/myinfo/Cjdata/getCjdataItems'/>"
					singleSelect="true" rownumbers="true" pagination="true"
					border="false" fit="true" fitColumns="true">
				<thead>
					<tr>
						<th field="createdate" width="80" sortable="true" formatter="formatcreatedate">成交日期</th>
<th field="address" width="200" sortable="true">房源地址</th>
<th field="area" width="80" sortable="true" formatter="formatarea">面积</th>
<th field="itype" width="50" sortable="true" formatter="formatitype">类型</th>

					</tr>
				</thead>
			</table>
		</div>
	</div>
	


	

</body>
